PopupWidgetScreen

open class PopupWidgetScreen(title: Text) : Screen, PopupParentElement

A base screen that supports popup widgets. See PopupParentElement for documentation on underlying implementations.

To add and remove popups from this screen, call PopupWidget.push and PopupWidget.pop

For most intents and purposes, treat this screen like a standard Screen, with a couple caveats:

  • Make sure to call super on resize, render, and keyPressed otherwise popup functionality will break

  • call super.render AFTER any custom rendering, or popups may appear improperly below custom elements

  • call super.keyPressed BEFORE custom key presses, otherwise clicks may improperly propagate through popups to elements underneath them

Author

fzzyhmstrs

Since

0.2.0, made render final and added renderContents 0.6.0

Parameters

title

Text, the screen title

See also

Constructors

Link copied to clipboard
constructor(title: Text)

Properties

Link copied to clipboard
Link copied to clipboard
@Nullable
@get:Nullable
var focused: Element?
Link copied to clipboard
var height: Int
Link copied to clipboard
open override var justClosedWidget: Boolean

Boolean prevents mouseReleased from triggering on the Popup or Widget underneath the active popup if it's closed on mouseClicked

Link copied to clipboard
open override var lastSelected: Element?

getter and setter for the cached element.

Link copied to clipboard
open override val popupWidgets: LinkedList<PopupWidget>

A stack for holding popupwidgets while allowing for easy list iteration as needed. For rendering this stack should be traversed in reverse order, which LinkedList makes easy with descendingIterator

Link copied to clipboard
var width: Int

Functions

Link copied to clipboard
Link copied to clipboard
open fun addCrashReportSection(report: CrashReport)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun blur()
Link copied to clipboard
open override fun charTyped(chr: Char, modifiers: Int): Boolean
Link copied to clipboard
open override fun children(): MutableList<out Element>
Link copied to clipboard
open fun close()
Link copied to clipboard
open fun filesDragged(paths: MutableList<Path>)
Link copied to clipboard
@Nullable
open override fun getFocusedPath(): GuiNavigationPath?
Link copied to clipboard
@Nullable
open fun getMusic(): MusicSound?
Link copied to clipboard
open fun getNarratedTitle(): Text
Link copied to clipboard
open override fun getNavigationFocus(): ScreenRect
Link copied to clipboard
Link copied to clipboard
@Nullable
open override fun getNavigationPath(navigation: GuiNavigation): GuiNavigationPath?
Link copied to clipboard
open fun getTextRenderer(): TextRenderer
Link copied to clipboard
open fun getTitle(): Text
Link copied to clipboard
open fun handleTextClick(@Nullable style: Style?): Boolean
Link copied to clipboard
open fun hoveredElement(mouseX: Double, mouseY: Double): Optional<Element>
Link copied to clipboard
fun init(client: MinecraftClient, width: Int, height: Int)
Link copied to clipboard
open override fun isFocused(): Boolean
Link copied to clipboard
open override fun isMouseOver(mouseX: Double, mouseY: Double): Boolean
Link copied to clipboard
open override fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean
Link copied to clipboard
open override fun keyReleased(keyCode: Int, scanCode: Int, modifiers: Int): Boolean
Link copied to clipboard
override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean
Link copied to clipboard
open override fun mouseDragged(mouseX: Double, mouseY: Double, button: Int, deltaX: Double, deltaY: Double): Boolean
Link copied to clipboard
open fun mouseMoved(mouseX: Double, mouseY: Double)
Link copied to clipboard
open override fun mouseReleased(mouseX: Double, mouseY: Double, button: Int): Boolean
Link copied to clipboard
open override fun mouseScrolled(mouseX: Double, mouseY: Double, horizontalAmount: Double, verticalAmount: Double): Boolean
Link copied to clipboard
open fun narrateScreenIfNarrationEnabled(onlyChangedNarrations: Boolean)
Link copied to clipboard
open fun onClick(mouseX: Double, mouseY: Double, button: Int): Boolean
Link copied to clipboard
open fun onDisplayed()
Link copied to clipboard
open override fun popLast()

Indicates that the overlay has been removed and the parent should return focus to the cached element, if any, in lastSelected

Link copied to clipboard
open override fun pushLast()

Indicates to the parent element to cache it's current focused element. The current focused element should be stored in lastSelected

Link copied to clipboard
open fun refreshNarrator(previouslyDisabled: Boolean)
Link copied to clipboard
open fun removed()
Link copied to clipboard
override fun render(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float)

Marked final to preserve proper popup ordering and rendering

Link copied to clipboard
open fun renderBackground(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float)
Link copied to clipboard
open fun renderContents(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float)

Render call that should be used to render the main contents of a subclass. This is used instead of overriding render for proper positioning of the popup stack.

Link copied to clipboard
open fun renderInGameBackground(context: DrawContext)
Link copied to clipboard
fun renderWithTooltip(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float)
Link copied to clipboard
open override fun resetHover(mouseX: Double, mouseY: Double)

When called the parent element should reselect a hovered element based on the supplied mouse positions, if it tracks such things

Link copied to clipboard
open override fun resize(client: MinecraftClient, width: Int, height: Int)
Link copied to clipboard
open override fun setFocused(focused: Boolean)
Link copied to clipboard
open fun setPopup(widget: PopupWidget?, mouseX: Double? = null, mouseY: Double? = null)

Applies a popup widget to this parent. If null is passed, removes the top (newest) popup instead

Link copied to clipboard
open fun setTooltip(tooltip: MutableList<OrderedText>)
open fun setTooltip(tooltip: Text)
open fun setTooltip(tooltip: MutableList<OrderedText>, positioner: TooltipPositioner, focused: Boolean)
open fun setTooltip(tooltip: Tooltip, positioner: TooltipPositioner, focused: Boolean)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun shouldPause(): Boolean
Link copied to clipboard
open fun tick()
Link copied to clipboard
open fun updateNarrator()